package com.dvj.nacos.discovery.server;

import cn.hutool.core.util.StrUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

//@SpringCloudApplication // 可以替换下面两个注解
@EnableDiscoveryClient
@SpringBootApplication
@RestController
public class ServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ServerApplication.class, args);
    }

    @GetMapping("/hello")
    public String sayHello(@RequestParam String name) {
        if (StrUtil.isBlank(name)) {
            name = "World";
        }
        return StrUtil.format("Hello, {}", name);
    }
}
